Properties

$ID

$ID : string

Class name of the plugin instance

Type

string

$api

$api : \rcube_plugin_api

Instance of Plugin API

Type

rcube_plugin_api

$task

$task : string

Regular expression defining task(s) to bind with

Type

string

$noajax

$noajax : bool

Disables plugin in AJAX requests

Type

bool

$noframe

$noframe : bool

Disables plugin in framed mode

Type

bool

$allowed_prefs

$allowed_prefs : array

A list of config option names that can be modified by the user via user interface (with save-prefs command)

Type

array

$home

$home : string

Type

string — Plugin directory location

$urlbase

$urlbase : string

Type

string — Base URL to the plugin directory

$mytask

$mytask : string

Type

string — Plugin task name (if registered)

$loaded_config

$loaded_config : array

Type

array — List of plugin configuration files already loaded

Methods

__construct()

__construct(\rcube_plugin_api  $api) : mixed

Default constructor.

Parameters

\rcube_plugin_api $api

Plugin API

Returns

mixed —

init()

init() : mixed

Initialization method, needs to be implemented by the plugin itself

Returns

mixed —

info()

info() : array

Provide information about this

Returns

array —

Meta information about a plugin or false if not implemented. As hash array with the following keys: name: The plugin name vendor: Name of the plugin developer version: Plugin version name license: License name (short form according to http://spdx.org/licenses/) uri: The URL to the plugin homepage or source repository src_uri: Direct download URL to the source code of this plugin require: List of plugins required for this one (as array of plugin names)

require_plugin()

require_plugin(mixed  $plugin_name) : bool

Attempt to load the given plugin which is required for the current plugin

Parameters

mixed $plugin_name

Returns

bool —

True on success, false on failure

include_plugin()

include_plugin(mixed  $plugin_name) : bool

Attempt to load the given plugin which is optional for the current plugin

Parameters

mixed $plugin_name

Returns

bool —

True on success, false on failure

load_config()

load_config(string  $fname = 'config.inc.php') : bool

Load local config file from plugins directory.

The loaded values are patched over the global configuration.

Parameters

string $fname

Config file name relative to the plugin's folder

Returns

bool —

True on success, false on failure

add_hook()

add_hook(string  $hook, mixed  $callback) : mixed

Register a callback function for a specific (server-side) hook

Parameters

string $hook

Hook name

mixed $callback

Callback function as string or array with object reference and method name

Returns

mixed —

remove_hook()

remove_hook(string  $hook, mixed  $callback) : mixed

Unregister a callback function for a specific (server-side) hook.

Parameters

string $hook

Hook name

mixed $callback

Callback function as string or array with object reference and method name

Returns

mixed —

add_texts()

add_texts(string  $dir, mixed  $add2client = false) : mixed

Load localized texts from the plugins dir

Parameters

string $dir

Directory to search in

mixed $add2client

Make texts also available on the client (array with list or true for all)

Returns

mixed —

add_label()

add_label() : mixed

Wrapper for add_label() adding the plugin ID as domain

Returns

mixed —

gettext()

gettext(string|array  $p) : string

Wrapper for rcube::gettext() adding the plugin ID as domain

Parameters

string|array $p

Named parameters array or label name

Returns

string —

Localized text

register_task()

register_task(string  $task) : mixed

Register this plugin to be responsible for a specific task

Parameters

string $task

Task name (only characters [a-z0-9_-] are allowed)

Returns

mixed —

register_action()

register_action(string  $action, mixed  $callback) : mixed

Register a handler for a specific client-request action

The callback will be executed upon a request like /?_task=mail&_action=plugin.myaction

Parameters

string $action

Action name (should be unique)

mixed $callback

Callback function as string or array with object reference and method name

Returns

mixed —

register_handler()

register_handler(string  $name, mixed  $callback) : mixed

Register a handler function for a template object

When parsing a template for display, tags like <roundcube:object name="plugin.myobject" /> will be replaced by the return value if the registered callback function.

Parameters

string $name

Object name (should be unique and start with 'plugin.')

mixed $callback

Callback function as string or array with object reference and method name

Returns

mixed —

include_script()

include_script(string  $fn) : mixed

Make this javascript file available on the client

Parameters

string $fn

File path; absolute or relative to the plugin directory

Returns

mixed —

include_stylesheet()

include_stylesheet(string  $fn) : mixed

Make this stylesheet available on the client

Parameters

string $fn

File path; absolute or relative to the plugin directory

Returns

mixed —

add_button()

add_button(array  $p, string  $container) : mixed

Append a button to a certain container

Parameters

array $p

Hash array with named parameters (as used in skin templates)

string $container

Container name where the buttons should be added to

Returns

mixed —

url()

url(string  $fn) : string

Generate an absolute URL to the given resource within the current plugin directory

Parameters

string $fn

The file name

Returns

string —

Absolute URL to the given resource

local_skin_path()

local_skin_path(string  $extra_dir = null, mixed  $skin_name = null) : string

Provide path to the currently selected skin folder within the plugin directory with a fallback to the default skin folder.

Parameters

string $extra_dir

Additional directory to search in (optional)

mixed $skin_name

Specific skin name(s) to look for, string or array (optional)

Returns

string —

Skin path relative to plugins directory

resource_url()

resource_url(string  $fn) : mixed

Make the given file name link into the plugin directory

Parameters

string $fn

Filename

Returns

mixed —

label_map_callback()

label_map_callback(string  $key) : string

Callback function for array_map

Parameters

string $key

Array key.

Returns

string —